//! Header for the PictureManager-class
/*!
	\file PictureManager.h
	\author Thomas Pfeiffer
	\date 13.11.2012

*/
#ifndef PICTUREMANAGER_H
#define PICTUREMANAGER_H

#include "Picture.h"
#include "SingletonBase.h"

//! Allows you to manage a list of pictures.
/*!
\class PictureManager
PictureManager is a class which allow you to manage a list of pictures.
It offers you functions to add pictures to the list and save all images
in the list to a file. The Pictures added to the Manager are automatically
removed/freed when the manager is destroyed.
*/
class PictureManager : public SingletonBase<PictureManager> {
public:
	//! DTor of the PictureManager
	/*!
	Frees memory of all pictures in the list.
	*/
	~PictureManager();

	//! Saves alle pictures in the list
	/*!
	SavePictures() saves all Pictures in the list to the file
	they are associated with.
	*/
	void SavePictures() const;
	
	//! Adds the picture pic to the list
	/*!
	Adds the picture pic to the end of the list.
	\param pic The picture you want to add to the manager. A copy of pic is stored.
	*/
	void addPicture(Picture * pic);

	//! Returns a pointer to a picture by its name
	/*!
	The function getPicture returns a Pointer to the picture which filename matches
	name.
	\param name The name of the picture you want to retrieve
	\returns A Pointer to the picutre with the filename name or 0 if no picture
			with the specified name is in the list.
	*/
	Picture* getPicture(std::string const& name) const;

	friend class SingletonBase<PictureManager>;
private:
	PictureManager() {};

	typedef std::list<Picture*> TPictures;
	typedef TPictures::iterator TPicturesIterator;
	typedef TPictures::const_iterator TPicturesConstIterator;

	TPictures mPictures;
};

#endif